# Maintainer: Antonio Rojas <arojas@archlinux.org>

_pyname=osqp
pkgname=python-$_pyname
pkgver=0.6.2.post9
pkgrel=1
pkgdesc='Python wrapper for OSQP: the Operator Splitting QP Solver'
url='https://osqp.org/'
license=(Apache)
arch=(loong64 x86_64)
depends=(python-scipy python-qdldl)
makedepends=(python-build python-installer python-setuptools python-wheel cmake)
checkdepends=(python-pytest intel-oneapi-mkl)
source=(https://pypi.org/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz)
sha256sums=('16b03bc7c5db921de0d97a308ed874d21af9080660eddd5e7cadb2ba3428b0ff')

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation --skip-dependency-check
}

check() {
  cd $_pyname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
